package com.ubuntuvim.threadframework.impl;

import com.ubuntuvim.threadframework.MethodRequest;
import com.ubuntuvim.threadframework.client.ActiveQueue;

public class ActiveObject implements Runnable {

	private ActiveQueue queue;
	
	public ActiveObject() {
		queue = new ActiveQueue();
	}
	
	public void enqueue(MethodRequest mr) {
		queue.enqueue(mr);
	}
	
	@Override
	public void run() {
		while (true) {
			MethodRequest mr = queue.dequeue();
			mr.call();
		}
	}

}
